package com.clei.dto;

/**
 * OBS对象信息
 *
 * @author Y
 * @date 2023-09-15
 */
public class ObsObjDTO {
    /**
     * 操作结果
     */
    private final boolean success;

    /**
     * objectKey
     */
    private String objectKey;

    /**
     * 访问url
     */
    private String visitUrl;

    private ObsObjDTO(boolean success) {
        this.success = success;
    }

    public ObsObjDTO(boolean success, String objectKey, String visitUrl) {
        this.success = success;
        this.objectKey = objectKey;
        this.visitUrl = visitUrl;
    }

    @Override
    public String toString() {
        return "ObsObjDTO{" +
                "success=" + success +
                ", objectKey='" + objectKey + '\'' +
                ", visitUrl='" + visitUrl + '\'' +
                '}';
    }

    public static ObsObjDTO fail() {
        return new ObsObjDTO(false);
    }

    public static ObsObjDTO fail(String objectKey) {
        return new ObsObjDTO(false, objectKey, null);
    }

    public static ObsObjDTO success(String objectKey) {
        return new ObsObjDTO(true, objectKey, null);
    }

    public static ObsObjDTO success(String objectKey, String visitUrl) {
        return new ObsObjDTO(true, objectKey, visitUrl);
    }
}